﻿<html>

	<head>
		<title>商品管理</title>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">

		<link href="../../css/skin/default/style.css?v=20200512" rel="stylesheet" type="text/css" />
		<link rel="stylesheet" href="../../css/dialog.css">
		<link href="../../js/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />

		<script src="../../js/lib/jquery/jquery-1.10.2.min.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/ligerui.all.js" type="text/javascript"></script>

		<script src="../../js/lib/ligerUI/js/plugins/ligerPopupEdit.js"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerLayout.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerForm.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerCheckBox.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerComboBox.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerDateEditor.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerRadio.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerTextBox.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerSpinner.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerTree.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerDrag.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerResizable.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerTip.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerMenu.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerToolBar.js" type="text/javascript"></script>
		<script src="../../js/lib/jquery.form.js" type="text/javascript"></script>
		<script src="../../js/lib/json2.js" type="text/javascript"></script>
		<script src="../../js/dialog.js"></script>
		<script src="../../js/JS/layout.js"></script>
		<script src="../../js/constants.js" type="text/javascript"></script>
		<script src="../../js/api.js" type="text/javascript"></script>

		<script type="text/javascript">
			var manager;
			$(document).hover(parent.hindMenu);

			var status = $api.getparastr("status");
			var isupdown = $api.getparastr("isupdown");
			var mid = $api.getparastr("mid");
			var productUrl = BaseUrl + "Product?token=" + $api.getStorage("token");
			var popPtype;

			$(function() {
				$("form").ligerForm();
				initContorl();
				toolbar();
				if(!status) {
					isupdown = -1;
					status = -1;
				}

				//,int sid,string key,int typeid,int status, int isupdown,int page,int pageSize
				var url = productUrl;
				var sender = "&status=" + status + "&key=";
				sender += "&typeid=0";
				sender += "&isupdown=" + isupdown;
				sender += "&sid=0";
				url += sender;
				manager = $("#maingrid4").ligerGrid({
					columns: [{
							display: '标题',
							name: 'title',
							align: 'left',
							width: 380,
							render: function(rowdata, rowindex, value) {
								var ret = "<img src=" + rowdata.Fhimg + " class='listimgs' style='float:left;top:5px;margin-right:5px' />";
								ret += "<div class='div-span-auto-line' style='margin-left:5px'>" + rowdata.Fsummary + "<br/>";

								ret += "<div>"
								return ret;

							}
						},
						{
							display: '状态',
							name: 'Fstatus',
							width: 120,
							isSort: true,
							render: function(rowdata, rowindex, value) {
								if(rowdata.Fstatus == 0) return '草稿';
								else if(rowdata.Fstatus == 1) return '正常';
								else if(rowdata.Fstatus == 2) return '待审核';
								return '审核不通过[' + rowdata.Freason + "]";
							}
						},
						{
							display: '货号',
							name: 'Fpcode',
							align: 'left',
							width: 180,
							isSort: true
						},
						{
							display: '条码',
							name: 'Fbarcode',
							align: 'left',
							width: 180
						},
						{
							display: '价格区间',
							name: 'Flowprice',
							isSort: true,
							width: 140,
							render: function(rowdata, rowindex, value) {
								return rowdata.Flowprice + "-" + rowdata.Fhighprice;

							}
						},
						{
							display: '原价',
							name: 'Foprice',
							isSort: true,
							width: 120,
							align: 'right'
						},
						{
							display: '售价',
							name: 'Fsaleprice',
							isSort: true,
							width: 120,
							align: 'left'
						},
						{
							display: '箱装数',
							name: 'Ft1',
							isSort: true,
							width: 120
						},
						{
							display: '大包装数',
							name: 'Ft2',
							isSort: true,
							width: 120
						},
						{
							display: '操作时间',
							name: 'Frefreshdt',
							isSort: true,
							minWidth: 220,
							render: function(rowdata, rowindex, value) {
								return $api.formatCTime(rowdata.Frefreshdt);
							}
						}

					],
					dataAction: 'server',
					url: url,
					method: 'get',
					width: '99.5%',
					height: '75%',
					rowHeight: 100,
					pageSize: 20,
					usePager: true, //是否分页  
					onDblClickRow: function(data, rowindex, rowobj) {
						window.location.href = 'Add.html?id=' + data.Fid;
					}
				});
			});

			function initContorl() {
				popPtype = $("#PType").ligerPopupEdit({
					valueField: 'PID',
					textField: 'Name',
					width: 160,
					onEnterDown: function(e) {
						parent.showPTypeDialog(function(row) {
							popPtype.setValue(row.Fid);
							popPtype.setText(row.Fname);
							doSearch(true);
						});
					},
					onButtonClick: function() {
						parent.showPTypeDialog(function(row) {
							popPtype.setValue(row.Fid);
							popPtype.setText(row.Fname);
							doSearch(true);
						});
					}

				});

			}

			function edit() {
				var row = manager.getSelectedRow();
				if(row) {
					window.location.href = 'Add.html?id=' + row.Fid;
				} else {
					$.ligerDialog.warn("请选择行");
				}
			}

			function toolbar() {
				$api.getLimit(mid, 0, function(data) {
					$("#icon-list").append(data);
				});
			}

			var popPtype;
			var Fbid;

			function initContorl() {
				popPtype = $("#PType").ligerPopupEdit({
					valueField: 'PID',
					textField: 'Name',
					width: 160,
					onEnterDown: function(e) {
						parent.showPTypeDialog(e);
					},
					onButtonClick: function() {
						parent.showPTypeDialog();
					}

				});

			}

			function putPType(row) {
				popPtype.setValue(row.Fid);
				popPtype.setText(row.Fname);
				doSearch(true);
			}

			function doSearch(high) {
				var key = $("#key").val();
				var sender = "&status=" + $("#Fstatus").val() + "&key=" + key;
				if(popPtype.getValue())
					sender += "&typeid=" + popPtype.getValue();
				else
					sender += "&typeid=0";
				sender += "&isupdown=" + isupdown;
				sender += "&sid=0";
				var url = productUrl + sender;
				manager.GetDataByURL(url);
			}

			function import2() {
				window.location.href = "import.html";
			}
		</script>

	</head>

	<body class="mainbody">
		<form id="form1" onsubmit="return false">
			<div style="display:none" class="div-alarm"></div>
			<div class="toolbar-wrap">
				<div class="toolbar">
					<div class="l-list">
						<ul id="icon-list" class="icon-list">
						</ul>
					</div>
				</div>
				<div class="div-content">
					<dl>
						<dt style="width: 60px;">状态</dt>
						<dd style="margin-left: 70px;">
							<div style="margin-left: 10px;float:left;">
								<select name="Fstatus" id="Fstatus" ltype="select" ligerui="{width:180}">
									<option value="-1" selected="selected">全部</option>
									<option value="0">草稿</option>
									<option value="1">正常</option>
									<option value="2">待审核</option>
									<option value="-11">审核未通过</option>
								</select>
							</div>
						</dd>
						<dt style="width: 60px;">商品类别</dt>
						<dd style="margin-left: 70px;">
							<div style="margin-left: 10px;float:left;">
								<input id="PType" name="PType" placeholder='商品类别' ligerui="{width:180}" />
							</div>
						</dd>
						<dt style="width: 60px;">关键词</dt>
						<dd style="margin-left: 70px;">
							<div style="margin-left: 10px;float:left;">
								<input type="text" placeholder='品名/货号/条码' ID="key" name="key" ltype="text" ligerui="{width:180,initSelect:true;nullText:'品名/货号/条码'}" />
							</div>
							<div style="float:left;margin-left: 10px;">
								<input style="display:inline" type="button" value="搜索" class="btn" onclick="doSearch();" />
							</div>
						</dd>
					</dl>
				</div>
			</div>

			<div id="maingrid4" style="margin: 0px;background:#fff;"></div>
			<div class="div-content" style="margin-top: 10px;width:99.5%">
				<div class="divhead">信息管理小贴士</div>
				<hr class="divline" />
				<div style="padding:1px 5px; line-height:22px;"><span style="font-weight:bold">上架：</span>快速上架按钮,只针对主动下架商品,草稿商品，请通过详情页上架。</div>
				<div style="padding:1px 5px; line-height:22px;"><span style="font-weight:bold">修改：</span>完善信息内容，提高信息质量；信息质量越高，越能吸引买家。</div>
				<div style="padding:1px 5px; line-height:22px;"><span style="font-weight:bold">删除：</span>平台只允许对草稿商品进行删除</div>

		</form>

	</body>

</html>